/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package plash.display;

/**
 *
 * @author User
 */
public class GraphicRectangleShape extends GraphicLinearPathShape
{

    private int _x;
    private int _y;
    private int _width;
    private int _height;
    private int _radiusTopLeft;
    private int _radiusTopRight;
    private int _radiusBottomLeft;
    private int _radiusBottomRight;

    public GraphicRectangleShape(Graphics g, int x, int y,
                                 int width, int height,
                                 int topLeftRadius, int topRightRadius,
                                 int bottomLeftRadius, int bottomRightRadius)
    {
        super(g);
        _x = x;
        _y = y;
        _width = width;
        _height = height;
        _radiusTopLeft = topLeftRadius;
        _radiusTopRight = topRightRadius;
        _radiusBottomLeft = bottomLeftRadius;
        _radiusBottomRight = bottomRightRadius;
        
        __minPoint.setX(x);
        __minPoint.setY(y);
        
        __maxPoint.setX(x + width);
        __maxPoint.setY(y + height);
        
        __boundingBox.setX(__minPoint.getX());
        __boundingBox.setY(__minPoint.getY());
        
        __boundingBox.setWidth(width);
        __boundingBox.setHeight(height);
    }

    public GraphicRectangleShape(Graphics g, int x, int y,
                                 int width, int height,
                                 int ellipseWidth, int ellipseHeight)
    {
        this(g, x, y, width, height, ellipseWidth, ellipseHeight, ellipseWidth, ellipseHeight);
    }
    
    public GraphicRectangleShape(Graphics g, int x, int y,
                                 int width, int height)
    {
        this(g, x, y, width, height, 0, 0, 0, 0);
    }

    @Override
    public void execute()
    {
        if(__g == null)
        {
            return;
        }
        if(__painter == null)
        {
            __painter = __g.getPainter();
        }

        __painter.rect(_x, _y, _width, _height, _radiusTopLeft, _radiusTopRight, _radiusBottomLeft, _radiusBottomRight);
    }
}
